package com.demo.Controller;

import com.demo.Service.StudentService;
import com.demo.component.StudentBeans;
import com.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

@Controller
public class StudentController {
//    @Autowired
//    private StudentService studentService;

    //private StudentService studentService;

    //set 注入
//    @Autowired
//    public void setStudentService(StudentService studentService) {
//        this.studentService = studentService;
//    }
//    @Autowired
//    private StudentService studentService;
//    @Autowired
//    public StudentController(StudentService studentService) {
//        this.studentService = studentService;
//    }

//    public void saiHi() {
//        studentService.saiHi();
//    }
    //@Resource(name = "student1")
    @Autowired
    @Qualifier("student2")
    private Student student1;
    public void saiHi() {
        System.out.println(student1.toString());
    }

}
